
// 对wxwx.request二次封装

const app = getApp();

module.exports = (url,data,method="get",header={})=>{
  // loading 动画
  wx.showLoading({
    title: 'Loading...',
    mask:true
  })

  return new Promise((resolve,reject)=>{
    wx.request({
      // 拼全地址
      url:app.config.apiBase + url,
      data,
      header,
      dataType:'json',
      success:resolve,
      fail:reject,
      complete:wx.hideLoading
    })
  })
}